package ru.technogeek.labs.dreamnote.theme.data;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Button;

public class FilterDbAdapter extends Button {
	public enum SortDirection {
		UP,
		DOWN
	}
	
	class FiletrDbHelper extends SQLiteOpenHelper {

		public FiletrDbHelper(Context context) {
			super(context, DATABASE_NAME, null, DATABASE_VERSION);
		}

		@Override
		public void onCreate(SQLiteDatabase db) {
			db.execSQL(CREATE_FILTERS_TABLE);
		}

		@Override
		public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
			
		}
	}
	
	public FilterDbAdapter(Context context, String name, Integer id, SortDirection direction) {
		super(context);
		this.name = name;
		this.sortDirection = direction;
		
		setId(id);
		setText(name);
	}
	
	///
	/// Returns filter display name
	/// Name name
	///
	public static final String KEY_NAME = "name";
	private String name;
	public String  getDisplayName() {return name;}
	
	///
	/// Return filter sort direction
	/// Name direction
	///
	public static final String KEY_DIRECTION = "direction";
	private SortDirection sortDirection;
	public SortDirection getSortDirection() {return sortDirection;}

	// DBVariables
	private static final String DATABASE_NAME = "daremnote";
	private static final String FILTER_TABLE = "filters";
    private static final int DATABASE_VERSION = 1;
    private static final String CREATE_FILTERS_TABLE = "create table"
    	+ FILTER_TABLE
    	+ " (_id integer primary key autoincrement, "
    	+ KEY_NAME + "text not null, "
    	+ KEY_DIRECTION + "deciaml not null); ";
    
    
    ///
    /// DB Functions
    ///
    
    /// open
    /// close
    /// create
    /// delete
    /// fetchall
    /// fetch
    /// update
    
}